package com.example.service_consumer.controller;

//import jakarta.annotation.Resource;
import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;


@RestController
public class HelloController {

    //    @Resource(name = "abc")
    @Autowired
    private RestTemplate restTemplate;



    @GetMapping("/consumer/hello")
    public String hello() {

        //String providerBack = restTemplate.getForObject("http://service-provider/provider/hello", String.class);
        String providerBack = restTemplate.getForObject("http://localhost:8081/provider/hello", String.class);
        return "consumer is here. " + "get Msg from " + providerBack;

    }

    @GetMapping("/say/hi")
    public String hi(){return "hi consumer";}
}
